package rpwd

import (
	"crypto/sha256"
	"fmt"
	"time"
)

// InitCreatePasswordFile 初始化创建一个password文件。
func InitCreatePasswordFile(filepath string) {
	hashStr1 := fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint(time.Now()))))
	hashStr2 := fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint(time.Now().AddDate(1, 2, 3)))))
	_ = AutoSavePasswordFile(filepath, map[string]AccountAndPassword{
		AccMongoDB: {Port: 27017, Account: "root", Password: "123456"},
		AccRedis:   {Port: 6379, Password: "123456"},
		AccMySQL:   {Port: 3306, Account: "root", Password: "123456"},
	}, map[string]string{
		KeyJwtSecretKey: hashStr1[:32],
		KeyPwdSecretKey: hashStr2[:32],
	}, map[string]any{})
}
